<html><head><title>GadgetAdvanced.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Gadget example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#924B72">#WindowWidth</font>  = 450
<font color="#924B72">#WindowHeight</font> = 305

<font color="#3A3966">; Load our images.. 
</font><font color="#3A3966">;
</font><font color="#3A3966">LoadImage</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/Drive.bmp&quot;)
<font color="#3A3966">LoadImage</font>(1, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/File.bmp&quot;)
<font color="#3A3966">LoadImage</font>(2, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/PureBasic.bmp&quot;)

<b><font color="#3A3966">CompilerIf</font></b> <font color="#924B72">#PB_Compiler_OS</font> = <font color="#924B72">#PB_OS_Windows</font>
  <font color="#3A3966">; Only Windows supports .ico file format
</font><font color="#3A3966">  LoadImage</font>(3, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/CdPlayer.ico&quot;)
<b><font color="#3A3966">CompilerElse</font></b>
<font color="#3A3966">  LoadImage</font>(3, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/Data/Drive.bmp&quot;)
<b><font color="#3A3966">CompilerEndIf</font></b>

<font color="#3A3966">CreatePopupMenu</font>(0)
<font color="#3A3966">  MenuItem</font>(0, &quot;Popup !&quot;)

<b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 100, 200, <font color="#924B72">#WindowWidth</font>, <font color="#924B72">#WindowHeight</font>, &quot;PureBasic - Advanced Gadget Demonstration&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_MinimizeGadget</font>)

<font color="#3A3966">  ListIconGadget</font>(5, 170, 50, 265, 200, &quot;Column 1&quot;, 131)
<font color="#3A3966">  AddGadgetColumn</font>(5, 1, &quot;Column 2&quot;, 300)
<font color="#3A3966">  AddGadgetColumn</font>(5, 2, &quot;Column 3&quot;, 80)
  
<font color="#3A3966">  TextGadget</font>(4, 10, 16, 180, 24, &quot;Please wait while initializing...&quot;)
  
<font color="#3A3966">  ProgressBarGadget</font>(3, 10, 260, <font color="#924B72">#WindowWidth</font>-25, 20, 0, 100)
  
  <font color="#3A3966">; Update the ProgressBar, just for fun !
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 100
<font color="#3A3966">    SetGadgetState</font>(3, k)
<font color="#3A3966">    Delay</font>(10)
  <b><font color="#3A3966">Next</font></b>
  
<font color="#3A3966">  ImageGadget      </font>(0, 200, 5, 0, 0,<font color="#3A3966"> ImageID</font>(2))
<font color="#3A3966">  ButtonImageGadget</font>(1, 384, 5, 50, 36,<font color="#3A3966"> ImageID</font>(3))
  
<font color="#3A3966">  TreeGadget    </font>(2,  10, 50, 150, 200)
    
<font color="#3A3966">  SetGadgetText</font>(4, &quot;Initialize Ok... Welcome !&quot;)
  
  <font color="#3A3966">; Fill Up the Tree gadget with lot of entries (including the image)
</font>  <font color="#3A3966">;
</font>  
  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 10
<font color="#3A3966">    AddGadgetItem</font>(2, -1, &quot;General &quot;+<font color="#3A3966">Str</font>(k),<font color="#3A3966"> ImageID</font>(1))
<font color="#3A3966">    AddGadgetItem</font>(2, -1, &quot;ScreenMode&quot;,<font color="#3A3966"> ImageID</font>(1))
<font color="#3A3966">      AddGadgetItem</font>(2, -1, &quot;640*480&quot;,<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, &quot;800*600&quot;,<font color="#3A3966"> ImageID</font>(3), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, &quot;1024*768&quot;,<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">      AddGadgetItem</font>(2, -1, &quot;1600*1200&quot;,<font color="#3A3966"> ImageID</font>(1), 1)
<font color="#3A3966">    AddGadgetItem</font>(2, -1, &quot;Joystick&quot;,<font color="#3A3966"> ImageID</font>(1))
  <b><font color="#3A3966">Next</font></b>
    
  <font color="#3A3966">; Fill Up the ListIcon gadget. Notice than the column are separated by Chr(10) (NewLine) character
</font>  <font color="#3A3966">;
</font>  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 100
<font color="#3A3966">    AddGadgetItem</font>(5, -1, &quot;Element &quot;+<font color="#3A3966">Str</font>(k)+<font color="#3A3966">Chr</font>(10)+&quot;C 2&quot;+<font color="#3A3966">Chr</font>(10)+&quot;Comment 3&quot;,<font color="#3A3966"> ImageID</font>(3))
  <b><font color="#3A3966">Next</font></b>
  
<font color="#3A3966">  SetGadgetState</font>(5, 8)
  
  <b><font color="#3A3966">Repeat</font></b>
    Event =<font color="#3A3966"> WaitWindowEvent</font>()

    <b><font color="#3A3966">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font>
      
      <b><font color="#3A3966">Select</font></b> <font color="#3A3966">EventGadget</font>()
        <b><font color="#3A3966">Case</font></b> 1
<font color="#3A3966">          MessageRequester</font>(&quot;Information&quot;, &quot;You did it !&quot;, 0)
      
        <b><font color="#3A3966">Case</font></b> 2
<font color="#3A3966">          SetGadgetText</font>(4, &quot;Tree Gadget. Item selected: &quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(2)))
          
          <b><font color="#3A3966">If</font></b> <font color="#3A3966">EventType</font>() = 2
<font color="#3A3966">            MessageRequester</font>(&quot;Information&quot;, &quot;Doubleclick: item&quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(2))+&quot;, Text: &quot;+<font color="#3A3966">GetGadgetText</font>(2), 0)
          <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">EventType</font>() = 1
<font color="#3A3966">            DisplayPopupMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))
          <b><font color="#3A3966">EndIf</font></b>
          
        <b><font color="#3A3966">Case</font></b> 5
<font color="#3A3966">          SetGadgetText</font>(4, &quot;ListIcon Gadget. Item selected: &quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(5)))
          
          <b><font color="#3A3966">If</font></b> <font color="#3A3966">EventType</font>() = 2
<font color="#3A3966">            MessageRequester</font>(&quot;Information&quot;, &quot;Doubleclick: item&quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">GetGadgetState</font>(5))+&quot;, Text: &quot;+<font color="#3A3966">GetGadgetText</font>(5), 0)
          <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">EventType</font>() = 1
<font color="#3A3966">            DisplayPopupMenu</font>(0,<font color="#3A3966"> WindowID</font>(0))
          <b><font color="#3A3966">EndIf</font></b>
          
     <b><font color="#3A3966">EndSelect</font></b>

    <b><font color="#3A3966">EndIf</font></b>
    
  <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b> </font></pre>
</body></html>
